<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>列表角色信息表</title>
    <meta name="keywords" content="列表角色信息表">
    <meta name="description" content="列表角色信息表">
    <link rel="shortcut icon" href="/web/favicon.ico">
    <link href="/web/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/web/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="/web/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=20210202" rel="stylesheet"/>
    <link href="/web/css/animate.min.css" rel="stylesheet"/>
    <link href="/web/css/style.css?v=20200903" rel="stylesheet"/>
    <link href="/web/andy/css/ry-ui.css?v=4.6.1" rel="stylesheet"/>
    <a id="scroll-up" href="javascript:void(0);" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
    <script src="/web/js/jquery.min.js"></script>
    <script src="/web/js/bootstrap.min.js"></script>
    <!-- bootstrap-table 表格插件 -->
    <script src="/web/ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/web/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20210202"></script>
    <script src="/web/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js"></script>
    <!-- jquery-validate 表单验证插件 -->
    <script src="/web/ajax/libs/validate/jquery.validate.min.js"></script>
    <script src="/web/ajax/libs/validate/messages_zh.min.js"></script>
    <script src="/web/ajax/libs/validate/jquery.validate.extend.js"></script>
    <!-- jquery-validate 表单树插件 -->
    <script src="/web/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
    <!-- 遮罩层 -->
    <script src="/web/ajax/libs/blockUI/jquery.blockUI.js"></script>
    <script src="/web/ajax/libs/iCheck/icheck.min.js"></script>
    <script src="/web/ajax/libs/layer/layer.min.js"></script>
    <script src="/web/ajax/libs/layui/layui.js"></script>
    <script src="/web/andy/js/common.js?v=4.6.1"></script>
    <script src="/web/andy/js/andy-ui.js?v=4.6.1"></script>
    <script src="/webjars/vue/2.6.14/vue.min.js"></script>
    <link href="/web/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css" rel="stylesheet"/>
    <script src="/web/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js"></script>
</head>
<body class="gray-bg" >
<div id="container">
    <div class="container-div" >
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="query">
                    <div class="select-list">
                        <ul>
                            <li>
                                角色名称：<input type="text" name="roleName" value="" v-model="param.roleName"/>
                            </li>
                            <li>
                                状态：
                                <select  name="status" v-model="param.status">
                                    <option value="-1">全部</option>
                                    <option value="0">启用</option>
                                    <option value="1">禁用</option>
                                </select>
                            </li>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>



</div>
<script>
    let index2;
    var roleId;
    let vm = new Vue({
        el:'#container',
        data:{
            datas:[],
            param:{
                visible:'',
                status:'-1'
            },
            entity:{
                dataScope:'1',
                status:'0',
                delFlag:'0'
            }
        },
        mounted(){
            init();
        }
    });

   function save(){
       let roles = $('#bootstrap-table').bootstrapTable('getSelections');
       if(roles.length==1){
           let role=roles[0];
           let roleId = role.roleId;
           let userId = parent.userId;
           $.operate.saveGet('/system/role/saveUserRole?userId='+userId+'&roleId='+roleId,function(ret){
              window.parent.close2();
           });
       }else{
           $.modal.alertWarning("请选择一条角色信息");
       }

   }
    function init(){
        var addFlag = false;
        addFlag=true;
        var editFlag = false;
        addFlag=true;
        var removeFlag = false;
        addFlag=true;
        var datas =[];
        var prefix =  "/system/role";

        let options={
            url:'/system/role/data',
            sortable:false,
            modalName:'角色',
            columns:[
                {
                    checkbox : true,
                    align : 'center'
                },
                {
                    field:'roleId',
                    title:'角色ID',
                    align: 'center',
                    halign: 'center',
                    sortable:true
                },
                {
                    field:'roleName',
                    title:'角色名称',
                    align: 'center',
                    halign: 'center',
                    sortable:true
                },
                {
                    field:'roleKey',
                    title:'角色权限字符串',
                    align: 'center',
                    halign: 'center',
                    sortable:true
                },
                {
                    field:'roleSort',
                    title:'显示顺序',
                    align: 'center',
                    halign: 'center',
                    sortable:true
                },
                {
                    field:'dataScope',
                    title:'数据范围',
                    align: 'center',
                    halign: 'center',
                    sortable:true,
                    visible:false
                },
                {
                    field:'status',
                    title:'角色状态',
                    align: 'center',
                    halign: 'center',
                    sortable:true,
                    formatter:function(value, row, index){
                        if(value==0){
                          return "<span class=\"label label-success\">启用</span>";
                        }else{
                            return "<span class=\"label label-danger\">禁用</span>";
                        }

                    }
                }
            ]
        }
        $.table.init(options);
    }


    function doSubmit(){
        $.operate.post("/system/role/save",JSON.stringify(vm.entity),function(ret){
            layer.closeAll();
        });
    }
</script>
</body>
</html>